package com.wushijia.netty;

import io.netty.bootstrap.Bootstrap;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;

public class NettyClient1 {

  public static void main(String[] args) {
    NioEventLoopGroup workGroup = new NioEventLoopGroup();
    Bootstrap bootstrap = new Bootstrap();
    bootstrap.group(workGroup).channel(NioSocketChannel.class)
        .handler(new ChannelInitializer<SocketChannel>() {
          @Override
          protected void initChannel(SocketChannel socketChannel) throws Exception {

          }
        });
    bootstrap.connect("juejin.cn", 80).addListener(future -> {
      if (future.isSuccess()) {
        System.out.println("连接成功");
      } else {
        System.out.println("连接失败");
      }
    });
  }
}
